/**
 * 
 */
package com.toncen.samepms.fisher;

import java.sql.Connection;

import com.toncen.samepms.system.dao.CodeDao;
import com.sky.fisher.db.AbstractConnectionProvider;
import com.sky.fisher.query.AbstractQuery;
import com.sky.fisher.query.JDBCQuery;

/**
 * 描述：数据库连接提供者
 * 
 * @author tch
 * 
 */
public class CWFFisherConnectionProvider extends AbstractConnectionProvider {
	private CodeDao codeDao = new CodeDao();

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.db.AbstractConnectionProvider#closeConnection(java.sql.Connection)
	 */
	@Override
	public void closeConnection(Object con) throws Exception {
		if (con != null && con instanceof Connection) {
			((Connection) con).close();
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.db.AbstractConnectionProvider#getConnection()
	 */
	public Object getConnection() throws Exception {
		return codeDao.getConnection();
	}

	/* (non-Javadoc)
	 * @see com.sky.fisher.db.AbstractConnectionProvider#getQuery()
	 */
	public AbstractQuery getQuery() throws Exception {
		return new JDBCQuery(this);
	}

}
